import config from '@/config';
import RequestBase from '@/utils/request.js';

const request = new RequestBase(config.specialWorkUrl);

/**
 * @description 获取待审查的工作票列表
 */
export function queryTicketInspectList(data) {
  return request.get('/spw/ticket-review/list', data);
}

/**
 * @description 获取作业票处理任务信息
 */
export function getCurrentInspectDetail(taskId) {
  return request.get(`/spw/ticket-review/task/${taskId}`);
}

/**
 * @description 获取回退的目标节点列表
 */
export function getInspectRollbackNodes(taskId) {
  return request.get(`/spw/ticket-review/rollback-nodes/${taskId}`);
}

/**
 * @description 获取节点人员列表
 */
export function getTicketNodeUsers(ticketId, nodeId) {
  return request.get(`/spw/ticket-review/node/users/${ticketId}/${nodeId}`);
}

/**
 * @description 保存审查作业票
 */
export function saveTicketInspect(taskId, data) {
  return request.post(`/spw/ticket-review/review/${taskId}`, {
		...data,
		showLoading: true
	});
}

/**
 * @description 获取气体库数据
 */
export function getHazardMediaLibs(data) {
  return request.get('/spw/hazard-media-lib/list', data);
}

/**
 * @description 获取分析项目类型
 */
export function getHazardMediaLibTypeList() {
  return request.get('/spw/hazard-media-lib/type/list');
}

/**
 * 根据id列表查询危害介质库
 */
export function getHazardMediaLibsByIds(data) {
  return request.post(`/spw/hazard-media-lib/listByIds`, data);
}

/**
 * 添加分析作业票
 */
export function saveTicketAnalyse(data) {
  return request.post(`/spw/ticket-analyse/analyse`, data);
}

/**
 * 批量添加分析作业票
 */
export function batchSaveTicketAnalyse(data) {
  return request.post(`/spw/ticket-analyse/analyse/batch`, data);
}

/**
 * 删除分析作业票
 */
export function deleteTicketAnalyse(analyseId) {
  return request.delete(`/spw/ticket-analyse/delete/${analyseId}`);
}
/**
 * 获取分析作业票列表
 */
export function getTicketAnalyse(ticketId) {
  return request.get(`/spw/ticket-analyse/list/${ticketId}`);
}

/**
 * 根据作业票类型获取完工配置
 */
export function getAcceptanceConfig(specialWorkType) {
  return request.get(`/spw/ticket-review/acceptance-config/${specialWorkType}`);
}


/**
 * 获取最近一次作业票分析信息
 */
export function getTicketAnalyseLatest(ticketId) {
  return request.get(`/spw/ticket-analyse/latest/${ticketId}`);
}

/**
 * 查询作业票的全部签名列表
 */
export function getTicketSignatures(ticketId) {
  return request.get(`/spw/ticket-review/signatures/${ticketId}`)
}
/**
 * 未完工说明配置
 */
export function getUnAcceptanceConfig() {
  return request.get(`/spw/ticket-review/un-acceptance-config`)
}
